@extends('common.admin_template')

@section('content')
    <div class="boxWidth">
        @include('common.notice_msg')
        <form method="post" action="{{url('admin/create/qr')}}">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <div class="row editFormItem">
            <div class="col-xs-3"><span>二维码链接</span></div>
            <div class="col-xs-8" id="linkBox"><input type="text" class="form-control" placeholder="请输入小程序二维码链接" id="link" name="Post[link]" value="{{$link}}"><div class="addInputNotice"></div></div>
        </div>
        <div class="row editFormItem">
            <div class="col-xs-3"><span>宽度</span></div>
            <div class="col-xs-8"><input type="text" class="form-control" id="qrWidth" placeholder="请输入小程序宽度，不填默认为430" name="Post[width]" value="{{$width}}"><div class="addInputNotice"></div></div>
        </div>
        <div class="row editFormItem">
            <div class="col-xs-3"><button class="btn btn-primary addInputBtn" type="submit" id="formSubmit">更新</button></div>
            <div class="col-xs-8"></div>
        </div>
        @if($url)
        <div class="row editFormItem">
            <div class="col-xs-12" style="text-align: center;"><img src="{{$url}}"></div>
        </div>
        @endif
        </form>
    </div>
@stop
@section('js')
    <script>
        (function () {
            $('#formSubmit').on('click',function (e) {
                if(!$('#link').val().replace(/(^\s*)|(\s*$)/g, "")){
                    $('#linkBox').addClass('has-error');
                    e.preventDefault();
                }
            });
        })();
    </script>
@stop